# 基础镜像
FROM php:8.1-fpm

# 维护作者
MAINTAINER 管理员

# 设置容器时区和宿主机相同
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtome && echo $TZ > /etc/timezone

# composer
RUN curl -sS https://getcomposer.org/installer | php \
    && mv composer.phar /usr/bin/composer && chmod +x /usr/bin/composer

#各种依赖库和扩展
RUN apt-get update \
    && apt-get install --yes zip unzip \
    && apt-get install -y \
    vim \
    git \
    wget \
    build-essential \
    libmagickcore-dev \
    libmagickwand-dev \
    imagemagick \
    libfreetype6-dev \
    libmcrypt-dev \
    libpng-dev \
    libzip-dev \
    libwebp-dev \
    libmemcached-dev \
    autoconf \
    pkg-config \
    gcc \
    make \
    zlib1g \
    zlib1g-dev \
    && docker-php-ext-configure gd  --with-webp=/usr/include/webp --with-jpeg=/usr/include --with-freetype=/usr/include/freetype2/ \
    && docker-php-ext-install -j$(nproc) gd iconv  pdo_mysql  mysqli bcmath calendar exif gettext sockets dba  pcntl  shmop sysvmsg sysvsem sysvshm zip \
    && pecl install redis-5.3.7 \
    && pecl install mcrypt \
    && docker-php-ext-enable redis mcrypt

#这句很重要，如果和你的nginx用户不同会导致你的服务起不来
RUN groupadd www && useradd -g www www

# 暴露端口号
EXPOSE 9000
#容器启动时执行指令
CMD ["php-fpm"]
